Integrand size = 19, antiderivative size = 146 \[ \int \frac {\cos (c+d x)}{(a+b \sec (c+d x))^2} \, dx=-\frac {2 b x}{a^3}+\frac {2 b^2 \left (3 a^2-2 b^2\right ) \text {arctanh}\left (\frac {\sqrt {a-b} \tan \left (\frac {1}{2} (c+d x)\right )}{\sqrt {a+b}}\right )}{a^3 (a-b)^{3/2} (a+b)^{3/2} d}+\frac {\left (a^2-2 b^2\right ) \sin (c+d x)}{a^2 \left (a^2-b^2\right ) d}+\frac {b^2 \sin (c+d x)}{a \left (a^2-b^2\right ) d (a+b \sec (c+d x))} \]
[Out]
Time = 0.42 (sec) , antiderivative size = 146, normalized size of antiderivative = 1.00, number of steps used = 6, number of rules used = 6, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.316, Rules used = {3932, 4189, 4004, 3916, 2738, 214} \[ \int \frac {\cos (c+d x)}{(a+b \sec (c+d x))^2} \, dx=-\frac {2 b x}{a^3}+\frac {\left (a^2-2 b^2\right ) \sin (c+d x)}{a^2 d \left (a^2-b^2\right )}+\frac {b^2 \sin (c+d x)}{a d \left (a^2-b^2\right ) (a+b \sec (c+d x))}+\frac {2 b^2 \left (3 a^2-2 b^2\right ) \text {arctanh}\left (\frac {\sqrt {a-b} \tan \left (\frac {1}{2} (c+d x)\right )}{\sqrt {a+b}}\right )}{a^3 d (a-b)^{3/2} (a+b)^{3/2}} \]
[In]
[Out]
Rule 214
Rule 2738
Rule 3916
Rule 3932
Rule 4004
Rule 4189
Rubi steps \begin{align*} \text {integral}& = \frac {b^2 \sin (c+d x)}{a \left (a^2-b^2\right ) d (a+b \sec (c+d x))}-\frac {\int \frac {\cos (c+d x) \left (-a^2+2 b^2+a b \sec (c+d x)-b^2 \sec ^2(c+d x)\right )}{a+b \sec (c+d x)} \, dx}{a \left (a^2-b^2\right )} \\ & = \frac {\left (a^2-2 b^2\right ) \sin (c+d x)}{a^2 \left (a^2-b^2\right ) d}+\frac {b^2 \sin (c+d x)}{a \left (a^2-b^2\right ) d (a+b \sec (c+d x))}+\frac {\int \frac {-2 b \left (a^2-b^2\right )+a b^2 \sec (c+d x)}{a+b \sec (c+d x)} \, dx}{a^2 \left (a^2-b^2\right )} \\ & = -\frac {2 b x}{a^3}+\frac {\left (a^2-2 b^2\right ) \sin (c+d x)}{a^2 \left (a^2-b^2\right ) d}+\frac {b^2 \sin (c+d x)}{a \left (a^2-b^2\right ) d (a+b \sec (c+d x))}+\frac {\left (b^2 \left (3 a^2-2 b^2\right )\right ) \int \frac {\sec (c+d x)}{a+b \sec (c+d x)} \, dx}{a^3 \left (a^2-b^2\right )} \\ & = -\frac {2 b x}{a^3}+\frac {\left (a^2-2 b^2\right ) \sin (c+d x)}{a^2 \left (a^2-b^2\right ) d}+\frac {b^2 \sin (c+d x)}{a \left (a^2-b^2\right ) d (a+b \sec (c+d x))}+\frac {\left (b \left (3 a^2-2 b^2\right )\right ) \int \frac {1}{1+\frac {a \cos (c+d x)}{b}} \, dx}{a^3 \left (a^2-b^2\right )} \\ & = -\frac {2 b x}{a^3}+\frac {\left (a^2-2 b^2\right ) \sin (c+d x)}{a^2 \left (a^2-b^2\right ) d}+\frac {b^2 \sin (c+d x)}{a \left (a^2-b^2\right ) d (a+b \sec (c+d x))}+\frac {\left (2 b \left (3 a^2-2 b^2\right )\right ) \text {Subst}\left (\int \frac {1}{1+\frac {a}{b}+\left (1-\frac {a}{b}\right ) x^2} \, dx,x,\tan \left (\frac {1}{2} (c+d x)\right )\right )}{a^3 \left (a^2-b^2\right ) d} \\ & = -\frac {2 b x}{a^3}+\frac {2 b^2 \left (3 a^2-2 b^2\right ) \text {arctanh}\left (\frac {\sqrt {a-b} \tan \left (\frac {1}{2} (c+d x)\right )}{\sqrt {a+b}}\right )}{a^3 (a-b)^{3/2} (a+b)^{3/2} d}+\frac {\left (a^2-2 b^2\right ) \sin (c+d x)}{a^2 \left (a^2-b^2\right ) d}+\frac {b^2 \sin (c+d x)}{a \left (a^2-b^2\right ) d (a+b \sec (c+d x))} \\ \end{align*}
Time = 0.83 (sec) , antiderivative size = 172, normalized size of antiderivative = 1.18 \[ \int \frac {\cos (c+d x)}{(a+b \sec (c+d x))^2} \, dx=\frac {\frac {4 b^2 \left (-3 a^2+2 b^2\right ) \text {arctanh}\left (\frac {(-a+b) \tan \left (\frac {1}{2} (c+d x)\right )}{\sqrt {a^2-b^2}}\right )}{\sqrt {a^2-b^2}}+\frac {-4 a b \left (a^2-b^2\right ) (c+d x) \cos (c+d x)+2 a b \left (a^2-2 b^2\right ) \sin (c+d x)+\left (a^2-b^2\right ) \left (-4 b^2 (c+d x)+a^2 \sin (2 (c+d x))\right )}{b+a \cos (c+d x)}}{2 a^3 (a-b) (a+b) d} \]
[In]
[Out]
Time = 0.75 (sec) , antiderivative size = 184, normalized size of antiderivative = 1.26
method | result | size |
derivativedivides | \(\frac {-\frac {2 \left (-\frac {a \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{1+\tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}}+2 b \arctan \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )\right )\right )}{a^{3}}-\frac {2 b^{2} \left (-\frac {a b \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{\left (a^{2}-b^{2}\right ) \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{2} a -\tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{2} b -a -b \right )}-\frac {\left (3 a^{2}-2 b^{2}\right ) \operatorname {arctanh}\left (\frac {\left (a -b \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{\sqrt {\left (a -b \right ) \left (a +b \right )}}\right )}{\left (a -b \right ) \left (a +b \right ) \sqrt {\left (a -b \right ) \left (a +b \right )}}\right )}{a^{3}}}{d}\) | \(184\) |
default | \(\frac {-\frac {2 \left (-\frac {a \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{1+\tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}}+2 b \arctan \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )\right )\right )}{a^{3}}-\frac {2 b^{2} \left (-\frac {a b \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{\left (a^{2}-b^{2}\right ) \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{2} a -\tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{2} b -a -b \right )}-\frac {\left (3 a^{2}-2 b^{2}\right ) \operatorname {arctanh}\left (\frac {\left (a -b \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{\sqrt {\left (a -b \right ) \left (a +b \right )}}\right )}{\left (a -b \right ) \left (a +b \right ) \sqrt {\left (a -b \right ) \left (a +b \right )}}\right )}{a^{3}}}{d}\) | \(184\) |
risch | \(-\frac {2 b x}{a^{3}}-\frac {i {\mathrm e}^{i \left (d x +c \right )}}{2 a^{2} d}+\frac {i {\mathrm e}^{-i \left (d x +c \right )}}{2 a^{2} d}-\frac {2 i b^{3} \left (b \,{\mathrm e}^{i \left (d x +c \right )}+a \right )}{a^{3} \left (a^{2}-b^{2}\right ) d \left (a \,{\mathrm e}^{2 i \left (d x +c \right )}+2 b \,{\mathrm e}^{i \left (d x +c \right )}+a \right )}+\frac {3 b^{2} \ln \left ({\mathrm e}^{i \left (d x +c \right )}+\frac {i a^{2}-i b^{2}+b \sqrt {a^{2}-b^{2}}}{\sqrt {a^{2}-b^{2}}\, a}\right )}{\sqrt {a^{2}-b^{2}}\, \left (a +b \right ) \left (a -b \right ) d a}-\frac {2 b^{4} \ln \left ({\mathrm e}^{i \left (d x +c \right )}+\frac {i a^{2}-i b^{2}+b \sqrt {a^{2}-b^{2}}}{\sqrt {a^{2}-b^{2}}\, a}\right )}{\sqrt {a^{2}-b^{2}}\, \left (a +b \right ) \left (a -b \right ) d \,a^{3}}-\frac {3 b^{2} \ln \left ({\mathrm e}^{i \left (d x +c \right )}-\frac {i a^{2}-i b^{2}-b \sqrt {a^{2}-b^{2}}}{\sqrt {a^{2}-b^{2}}\, a}\right )}{\sqrt {a^{2}-b^{2}}\, \left (a +b \right ) \left (a -b \right ) d a}+\frac {2 b^{4} \ln \left ({\mathrm e}^{i \left (d x +c \right )}-\frac {i a^{2}-i b^{2}-b \sqrt {a^{2}-b^{2}}}{\sqrt {a^{2}-b^{2}}\, a}\right )}{\sqrt {a^{2}-b^{2}}\, \left (a +b \right ) \left (a -b \right ) d \,a^{3}}\) | \(456\) |
[In]
[Out]
none
Time = 0.31 (sec) , antiderivative size = 565, normalized size of antiderivative = 3.87 \[ \int \frac {\cos (c+d x)}{(a+b \sec (c+d x))^2} \, dx=\left [-\frac {4 \, {\left (a^{5} b - 2 \, a^{3} b^{3} + a b^{5}\right )} d x \cos \left (d x + c\right ) + 4 \, {\left (a^{4} b^{2} - 2 \, a^{2} b^{4} + b^{6}\right )} d x - {\left (3 \, a^{2} b^{3} - 2 \, b^{5} + {\left (3 \, a^{3} b^{2} - 2 \, a b^{4}\right )} \cos \left (d x + c\right )\right )} \sqrt {a^{2} - b^{2}} \log \left (\frac {2 \, a b \cos \left (d x + c\right ) - {\left (a^{2} - 2 \, b^{2}\right )} \cos \left (d x + c\right )^{2} + 2 \, \sqrt {a^{2} - b^{2}} {\left (b \cos \left (d x + c\right ) + a\right )} \sin \left (d x + c\right ) + 2 \, a^{2} - b^{2}}{a^{2} \cos \left (d x + c\right )^{2} + 2 \, a b \cos \left (d x + c\right ) + b^{2}}\right ) - 2 \, {\left (a^{5} b - 3 \, a^{3} b^{3} + 2 \, a b^{5} + {\left (a^{6} - 2 \, a^{4} b^{2} + a^{2} b^{4}\right )} \cos \left (d x + c\right )\right )} \sin \left (d x + c\right )}{2 \, {\left ({\left (a^{8} - 2 \, a^{6} b^{2} + a^{4} b^{4}\right )} d \cos \left (d x + c\right ) + {\left (a^{7} b - 2 \, a^{5} b^{3} + a^{3} b^{5}\right )} d\right )}}, -\frac {2 \, {\left (a^{5} b - 2 \, a^{3} b^{3} + a b^{5}\right )} d x \cos \left (d x + c\right ) + 2 \, {\left (a^{4} b^{2} - 2 \, a^{2} b^{4} + b^{6}\right )} d x - {\left (3 \, a^{2} b^{3} - 2 \, b^{5} + {\left (3 \, a^{3} b^{2} - 2 \, a b^{4}\right )} \cos \left (d x + c\right )\right )} \sqrt {-a^{2} + b^{2}} \arctan \left (-\frac {\sqrt {-a^{2} + b^{2}} {\left (b \cos \left (d x + c\right ) + a\right )}}{{\left (a^{2} - b^{2}\right )} \sin \left (d x + c\right )}\right ) - {\left (a^{5} b - 3 \, a^{3} b^{3} + 2 \, a b^{5} + {\left (a^{6} - 2 \, a^{4} b^{2} + a^{2} b^{4}\right )} \cos \left (d x + c\right )\right )} \sin \left (d x + c\right )}{{\left (a^{8} - 2 \, a^{6} b^{2} + a^{4} b^{4}\right )} d \cos \left (d x + c\right ) + {\left (a^{7} b - 2 \, a^{5} b^{3} + a^{3} b^{5}\right )} d}\right ] \]
[In]
[Out]
\[ \int \frac {\cos (c+d x)}{(a+b \sec (c+d x))^2} \, dx=\int \frac {\cos {\left (c + d x \right )}}{\left (a + b \sec {\left (c + d x \right )}\right )^{2}}\, dx \]
[In]
[Out]
Exception generated. \[ \int \frac {\cos (c+d x)}{(a+b \sec (c+d x))^2} \, dx=\text {Exception raised: ValueError} \]
[In]
[Out]
Leaf count of result is larger than twice the leaf count of optimal. 837 vs. \(2 (137) = 274\).
Time = 0.37 (sec) , antiderivative size = 837, normalized size of antiderivative = 5.73 \[ \int \frac {\cos (c+d x)}{(a+b \sec (c+d x))^2} \, dx=-\frac {\frac {{\left (2 \, a^{7} b - 5 \, a^{6} b^{2} - 4 \, a^{5} b^{3} + 9 \, a^{4} b^{4} + 2 \, a^{3} b^{5} - 4 \, a^{2} b^{6} - 2 \, a^{2} b {\left | -a^{5} + a^{3} b^{2} \right |} - a b^{2} {\left | -a^{5} + a^{3} b^{2} \right |} + 2 \, b^{3} {\left | -a^{5} + a^{3} b^{2} \right |}\right )} {\left (\pi \left \lfloor \frac {d x + c}{2 \, \pi } + \frac {1}{2} \right \rfloor + \arctan \left (\frac {\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )}{\sqrt {-\frac {a^{4} b - a^{2} b^{3} + \sqrt {{\left (a^{5} + a^{4} b - a^{3} b^{2} - a^{2} b^{3}\right )} {\left (a^{5} - a^{4} b - a^{3} b^{2} + a^{2} b^{3}\right )} + {\left (a^{4} b - a^{2} b^{3}\right )}^{2}}}{a^{5} - a^{4} b - a^{3} b^{2} + a^{2} b^{3}}}}\right )\right )}}{a^{4} b {\left | -a^{5} + a^{3} b^{2} \right |} - a^{2} b^{3} {\left | -a^{5} + a^{3} b^{2} \right |} + {\left (a^{5} - a^{3} b^{2}\right )}^{2}} + \frac {{\left ({\left (2 \, a^{2} b + a b^{2} - 2 \, b^{3}\right )} \sqrt {-a^{2} + b^{2}} {\left | -a^{5} + a^{3} b^{2} \right |} {\left | -a + b \right |} + {\left (2 \, a^{7} b - 5 \, a^{6} b^{2} - 4 \, a^{5} b^{3} + 9 \, a^{4} b^{4} + 2 \, a^{3} b^{5} - 4 \, a^{2} b^{6}\right )} \sqrt {-a^{2} + b^{2}} {\left | -a + b \right |}\right )} {\left (\pi \left \lfloor \frac {d x + c}{2 \, \pi } + \frac {1}{2} \right \rfloor + \arctan \left (\frac {\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )}{\sqrt {-\frac {a^{4} b - a^{2} b^{3} - \sqrt {{\left (a^{5} + a^{4} b - a^{3} b^{2} - a^{2} b^{3}\right )} {\left (a^{5} - a^{4} b - a^{3} b^{2} + a^{2} b^{3}\right )} + {\left (a^{4} b - a^{2} b^{3}\right )}^{2}}}{a^{5} - a^{4} b - a^{3} b^{2} + a^{2} b^{3}}}}\right )\right )}}{{\left (a^{5} - a^{3} b^{2}\right )}^{2} {\left (a^{2} - 2 \, a b + b^{2}\right )} - {\left (a^{6} b - 2 \, a^{5} b^{2} + 2 \, a^{3} b^{4} - a^{2} b^{5}\right )} {\left | -a^{5} + a^{3} b^{2} \right |}} - \frac {2 \, {\left (a^{3} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - a^{2} b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - a b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} + 2 \, b^{3} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - a^{3} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - a^{2} b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + a b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 2 \, b^{3} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )\right )}}{{\left (a \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{4} - b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{4} - 2 \, b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} - a - b\right )} {\left (a^{4} - a^{2} b^{2}\right )}}}{d} \]
[In]
[Out]
Time = 19.39 (sec) , antiderivative size = 3169, normalized size of antiderivative = 21.71 \[ \int \frac {\cos (c+d x)}{(a+b \sec (c+d x))^2} \, dx=\text {Too large to display} \]
[In]
[Out]